home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / appleman / evtprog1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-06  |  1.7 KB  |  54 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Events - initializtion & painting"
  4.    ClientHeight    =   3765
  5.    ClientLeft      =   1020
  6.    ClientTop       =   1590
  7.    ClientWidth     =   4035
  8.    Height          =   4170
  9.    Left            =   960
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3765
  12.    ScaleWidth      =   4035
  13.    Top             =   1245
  14.    Width           =   4155
  15.    Begin PictureBox Picture1 
  16.       Height          =   2655
  17.       Left            =   300
  18.       ScaleHeight     =   2625
  19.       ScaleWidth      =   2685
  20.       TabIndex        =   0
  21.       Top             =   480
  22.       Width           =   2715
  23.    End
  24. Option Explicit
  25. ' This function adjusts the positions of screen elements
  26. ' for this form
  27. Sub AdjustPositions ()
  28.     ' Set the picture control flush with the left side,
  29.     ' keep the current width, but fill the height of the form
  30.     picture1.Move 0, 0, picture1.Width, ScaleHeight
  31.     ' Be sure the picture is large enough
  32.     If ScaleWidth < 3600 Then
  33.         Move left, top, 3700, Height
  34.         Exit Sub
  35.     End If
  36. End Sub
  37. Sub Form_Resize ()
  38.     ' 1:    Every form gets a resize event when it is
  39.     '       created.
  40.     '       It also gets this event when the form is
  41.     '       resized by the user
  42.     AdjustPositions
  43. End Sub
  44. Sub Picture1_Paint ()
  45.     ' 2 -   The Paint event occurs when any part of the window
  46.     '       needs to be updated.
  47.     picture1.Line (0, 0)-(picture1.ScaleWidth, picture1.ScaleHeight)
  48. End Sub
  49. Sub Picture1_Resize ()
  50.     ' 3 - In this case we also need to force an update
  51.     '       any time the size of the picture changes.
  52.     picture1.Refresh
  53. End Sub
  54.